<?
$smarty=new Smarty();
if(!ANTIHACK) die("ANTIHACK...");
$smarty->assign("nameact","Sắp xếp chuyên mục");
if($_POST[save])
{
	$json=json_encode($_POST[khung]);
	$data= array("content1" => $json);
	$ret=update($data,"other","code='box-order'");
	if($ret)
		$smarty->assign("msg","Lưu sắp xếp thành công");
	else
		$smarty->assign("msg","Có lỗi");
}
	$ar=query("select content1 from other where code='box-order'");
	$far=fetch($ar);
	$arr=json_decode($far['content1'],true);
	$smarty->assign("arr",$arr);
	$q=query("select * from menu where type!='page'");
	while($r=fetch($q))
	{
		$menu[$r[id]]=$r[name];
	}
	$smarty->assign("menu",$menu);

$smarty->display("box-order.htm");
?>